/*******************************************************************************
* Copyright (C) 2015 Spansion LLC. All Rights Reserved. 
*
* This software is owned and published by: 
* Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA  94088-3453 ("Spansion").
*
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND 
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
*
* This software contains source code for use with Spansion 
* components. This software is licensed by Spansion to be adapted only 
* for use in systems utilizing Spansion components. Spansion shall not be 
* responsible for misuse or illegal use of this software for devices not 
* supported herein.  Spansion is providing this software "AS IS" and will 
* not be responsible for issues arising from incorrect user implementation 
* of the software.  
*
* SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS), 
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING, 
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED 
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED 
* WARRANTY OF NONINFRINGEMENT.  
* SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT, 
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT 
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, 
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR 
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT, 
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA, 
* SAVINGS OR PROFITS, 
* EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED 
* FROM, THE SOFTWARE.  
*
* This software may be replicated in part or whole for the licensed use, 
* with the restriction that this Disclaimer and Copyright notice must be 
* included with each copy of this software, whether used in part or whole, 
* at all times.  
*****************************************************************************/
/** \file HSSPI.h
 **
 ** \brief driver level
 **          Driver of HS-SPI
 **
 ** \history
 **   - 2015-03-01 1.00 First version
 **
 *****************************************************************************/

#include "_fr.h"

#ifndef __HSSPI_H__
#define __HSSPI_H__

#ifdef  __GDC_DEFINE
#define __GDC_EXTERN
#else
#define __GDC_EXTERN   extern
#endif

#if 0
#define THIS_ATTR	IO
#else
#define THIS_ATTR	DATA
#endif

/***** HSSPI controller *****/

#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_MCTRL,attr=THIS_ATTR,locate=0x23B3000
#endif

typedef union {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD reserved17:1;
		__WORD reserved16:1;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD reserved11:1;
		__WORD reserved10:1;
		__WORD reserved09:1;
		__WORD reserved08:1;
		__WORD reserved07:1;
		__WORD reserved06:1;
        __WORD SYNCON:1;
		__WORD MES:1;
		__WORD reserved03:1;
		__WORD reserved02:1;
		__WORD CSEN:1;
		__WORD MEN:1;
		} bit;
} unHSSPIMCTRL_t;

__GDC_EXTERN unHSSPIMCTRL_t GDC_HSSPI_MCTRL;


#define HSSPI_MCTRL				(GDC_HSSPI_MCTRL.word)
#define HSSPI_MCTRL_MEN			(GDC_HSSPI_MCTRL.bit.MEN)
#define HSSPI_MCTRL_CSEN    	(GDC_HSSPI_MCTRL.bit.CSEN)
#define HSSPI_MCTRL_MES     	(GDC_HSSPI_MCTRL.bit.MES)
#define HSSPI_MCTRL_SYNCON	    (GDC_HSSPI_MCTRL.bit.SYNCON)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_PCC0,attr=THIS_ATTR,locate=0x23B3004
#endif

typedef union unHSSPIPCCx {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD RDDSE:2;
		__WORD WRDSE:4;
		__WORD SAFESYNC:1;
		__WORD CDRS:7;
		__WORD SENDIAN:1;
		__WORD SDIR:1;
        __WORD SS2CD:2;
		__WORD SSPOL:1;
		__WORD RTM:1;
		__WORD ACES:1;
		__WORD CPOL:1;
		__WORD CPHA:1;
		} bit;
} unHSSPIPCCx_t;

__GDC_EXTERN unHSSPIPCCx_t GDC_HSSPI_PCC3;
#define HSSPI_PCC3			    (GDC_HSSPI_PCC3.word)
#define HSSPI_PCC3_CPHA    	    (GDC_HSSPI_PCC3.bit.CPHA)
#define HSSPI_PCC3_CPOL         (GDC_HSSPI_PCC3.bit.CPOL)
#define HSSPI_PCC3_ACES	        (GDC_HSSPI_PCC3.bit.ACES)
#define HSSPI_PCC3_RTM	        (GDC_HSSPI_PCC3.bit.RTM)
#define HSSPI_PCC3_SSPOL	    (GDC_HSSPI_PCC3.bit.SSPOL)
#define HSSPI_PCC3_SS2CD	    (GDC_HSSPI_PCC3.bit.SS2CD)
#define HSSPI_PCC3_SDIR	        (GDC_HSSPI_PCC3.bit.SDIR)
#define HSSPI_PCC3_SENDIAN	    (GDC_HSSPI_PCC3.bit.SENDIAN)
#define HSSPI_PCC3_CDRS	        (GDC_HSSPI_PCC3.bit.CDRS)
#define HSSPI_PCC3_SAFESYNC	    (GDC_HSSPI_PCC3.bit.SAFESYNC)
#define HSSPI_PCC3_WRDSE	    (GDC_HSSPI_PCC3.bit.WRDSE)
#define HSSPI_PCC3_RDDSE	    (GDC_HSSPI_PCC3.bit.RDDSE)

__GDC_EXTERN unHSSPIPCCx_t GDC_HSSPI_PCC2;
#define HSSPI_PCC2			    (GDC_HSSPI_PCC2.word)
#define HSSPI_PCC2_CPHA    	    (GDC_HSSPI_PCC2.bit.CPHA)
#define HSSPI_PCC2_CPOL         (GDC_HSSPI_PCC2.bit.CPOL)
#define HSSPI_PCC2_ACES	        (GDC_HSSPI_PCC2.bit.ACES)
#define HSSPI_PCC2_RTM	        (GDC_HSSPI_PCC2.bit.RTM)
#define HSSPI_PCC2_SSPOL	    (GDC_HSSPI_PCC2.bit.SSPOL)
#define HSSPI_PCC2_SS2CD	    (GDC_HSSPI_PCC2.bit.SS2CD)
#define HSSPI_PCC2_SDIR	        (GDC_HSSPI_PCC2.bit.SDIR)
#define HSSPI_PCC2_SENDIAN	    (GDC_HSSPI_PCC2.bit.SENDIAN)
#define HSSPI_PCC2_CDRS	        (GDC_HSSPI_PCC2.bit.CDRS)
#define HSSPI_PCC2_SAFESYNC	    (GDC_HSSPI_PCC2.bit.SAFESYNC)
#define HSSPI_PCC2_WRDSE	    (GDC_HSSPI_PCC2.bit.WRDSE)
#define HSSPI_PCC2_RDDSE	    (GDC_HSSPI_PCC2.bit.RDDSE)

__GDC_EXTERN unHSSPIPCCx_t GDC_HSSPI_PCC1;
#define HSSPI_PCC1			    (GDC_HSSPI_PCC1.word)
#define HSSPI_PCC1_CPHA    	    (GDC_HSSPI_PCC1.bit.CPHA)
#define HSSPI_PCC1_CPOL         (GDC_HSSPI_PCC1.bit.CPOL)
#define HSSPI_PCC1_ACES	        (GDC_HSSPI_PCC1.bit.ACES)
#define HSSPI_PCC1_RTM	        (GDC_HSSPI_PCC1.bit.RTM)
#define HSSPI_PCC1_SSPOL	    (GDC_HSSPI_PCC1.bit.SSPOL)
#define HSSPI_PCC1_SS2CD	    (GDC_HSSPI_PCC1.bit.SS2CD)
#define HSSPI_PCC1_SDIR	        (GDC_HSSPI_PCC1.bit.SDIR)
#define HSSPI_PCC1_SENDIAN	    (GDC_HSSPI_PCC1.bit.SENDIAN)
#define HSSPI_PCC1_CDRS	        (GDC_HSSPI_PCC1.bit.CDRS)
#define HSSPI_PCC1_SAFESYNC	    (GDC_HSSPI_PCC1.bit.SAFESYNC)
#define HSSPI_PCC1_WRDSE	    (GDC_HSSPI_PCC1.bit.WRDSE)
#define HSSPI_PCC1_RDDSE	    (GDC_HSSPI_PCC1.bit.RDDSE)


__GDC_EXTERN unHSSPIPCCx_t GDC_HSSPI_PCC0;
#define HSSPI_PCC0			    (GDC_HSSPI_PCC0.word)
#define HSSPI_PCC0_CPHA    	    (GDC_HSSPI_PCC0.bit.CPHA)
#define HSSPI_PCC0_CPOL         (GDC_HSSPI_PCC0.bit.CPOL)
#define HSSPI_PCC0_ACES	        (GDC_HSSPI_PCC0.bit.ACES)
#define HSSPI_PCC0_RTM	        (GDC_HSSPI_PCC0.bit.RTM)
#define HSSPI_PCC0_SSPOL	    (GDC_HSSPI_PCC0.bit.SSPOL)
#define HSSPI_PCC0_SS2CD	    (GDC_HSSPI_PCC0.bit.SS2CD)
#define HSSPI_PCC0_SDIR	        (GDC_HSSPI_PCC0.bit.SDIR)
#define HSSPI_PCC0_SENDIAN	    (GDC_HSSPI_PCC0.bit.SENDIAN)
#define HSSPI_PCC0_CDRS	        (GDC_HSSPI_PCC0.bit.CDRS)
#define HSSPI_PCC0_SAFESYNC	    (GDC_HSSPI_PCC0.bit.SAFESYNC)
#define HSSPI_PCC0_WRDSE	    (GDC_HSSPI_PCC0.bit.WRDSE)
#define HSSPI_PCC0_RDDSE	    (GDC_HSSPI_PCC0.bit.RDDSE)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_TXF,attr=THIS_ATTR,locate=0x23B3014
#endif

typedef union unHSSPITXF {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD reserved17:1;
		__WORD reserved16:1;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD reserved11:1;
		__WORD reserved10:1;
		__WORD reserved09:1;
		__WORD reserved08:1;
		__WORD reserved07:1;
		__WORD TSSRS:1;
		__WORD TFMTS:1;
		__WORD TFLETS:1;
		__WORD TFUS:1;
		__WORD TFOS:1;
		__WORD TFES:1;
		__WORD TFFS:1;
	} bit;
} unHSSPITXF_t;

__GDC_EXTERN unHSSPITXF_t GDC_HSSPI_TXF;
#define HSSPI_TXF           (GDC_HSSPI_TXF.word)
#define HSSPI_TXF_TFFS      (GDC_HSSPI_TXF.bit.TFFS)
#define HSSPI_TXF_TFES      (GDC_HSSPI_TXF.bit.TFES)
#define HSSPI_TXF_TFOS      (GDC_HSSPI_TXF.bit.TFOS)
#define HSSPI_TXF_TFUS      (GDC_HSSPI_TXF.bit.TFUS)
#define HSSPI_TXF_TFLETS    (GDC_HSSPI_TXF.bit.TFLETS)
#define HSSPI_TXF_TFMTS     (GDC_HSSPI_TXF.bit.TFMTS)
#define HSSPI_TXF_TSSRS     (GDC_HSSPI_TXF.bit.TSSRS)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_TXE,attr=THIS_ATTR,locate=0x23B3018
#endif

typedef union unHSSPITXE {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD reserved17:1;
		__WORD reserved16:1;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD reserved11:1;
		__WORD reserved10:1;
		__WORD reserved09:1;
		__WORD reserved08:1;
		__WORD reserved07:1;
		__WORD TSSRE:1;
		__WORD TFMTE:1;
		__WORD TFLETE:1;
		__WORD TFUE:1;
		__WORD TFOE:1;
		__WORD TFEE:1;
		__WORD TFFE:1;
	} bit;
} unHSSPITXE_t;

__GDC_EXTERN unHSSPITXE_t GDC_HSSPI_TXE;
#define HSSPI_TXE           (GDC_HSSPI_TXE.word)
#define HSSPI_TXE_TFFE      (GDC_HSSPI_TXE.bit.TFFE)
#define HSSPI_TXE_TFEE      (GDC_HSSPI_TXE.bit.TFEE)
#define HSSPI_TXE_TFOE      (GDC_HSSPI_TXE.bit.TFOE)
#define HSSPI_TXE_TFUE      (GDC_HSSPI_TXE.bit.TFUE)
#define HSSPI_TXE_TFLETE    (GDC_HSSPI_TXE.bit.TFLETE)
#define HSSPI_TXE_TFMTE     (GDC_HSSPI_TXE.bit.TFMTE)
#define HSSPI_TXE_TSSRE     (GDC_HSSPI_TXE.bit.TSSRE)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_TXC,attr=THIS_ATTR,locate=0x23B301C
#endif

typedef union unHSSPITXC {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD reserved17:1;
		__WORD reserved16:1;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD reserved11:1;
		__WORD reserved10:1;
		__WORD reserved09:1;
		__WORD reserved08:1;
		__WORD reserved07:1;
		__WORD TSSRC:1;
		__WORD TFMTC:1;
		__WORD TFLETC:1;
		__WORD TFUC:1;
		__WORD TFOC:1;
		__WORD TFEC:1;
		__WORD TFFC:1;
	} bit;
} unHSSPITXC_t;

__GDC_EXTERN unHSSPITXC_t GDC_HSSPI_TXC;
#define HSSPI_TXC           (GDC_HSSPI_TXC.word)
#define HSSPI_TXC_TFFC      (GDC_HSSPI_TXC.bit.TFFC)
#define HSSPI_TXC_TFEC      (GDC_HSSPI_TXC.bit.TFEC)
#define HSSPI_TXC_TFOC      (GDC_HSSPI_TXC.bit.TFOC)
#define HSSPI_TXC_TFUC      (GDC_HSSPI_TXC.bit.TFUC)
#define HSSPI_TXC_TFLETC    (GDC_HSSPI_TXC.bit.TFLETC)
#define HSSPI_TXC_TFMTC     (GDC_HSSPI_TXC.bit.TFMTC)
#define HSSPI_TXC_TSSRC     (GDC_HSSPI_TXC.bit.TSSRC)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_RXF,attr=THIS_ATTR,locate=0x23B3020
#endif

typedef union unHSSPIRXF {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD reserved17:1;
		__WORD reserved16:1;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD reserved11:1;
		__WORD reserved10:1;
		__WORD reserved09:1;
		__WORD reserved08:1;
		__WORD reserved07:1;
		__WORD RSSRS:1;
		__WORD RFMTS:1;
		__WORD RFLETS:1;
		__WORD RFUS:1;
		__WORD RFOS:1;
		__WORD RFES:1;
		__WORD RFFS:1;
	} bit;
} unHSSPIRXF_t;

__GDC_EXTERN unHSSPIRXF_t GDC_HSSPI_RXF;
#define HSSPI_RXF           (GDC_HSSPI_RXF.word)
#define HSSPI_RXF_RFFS      (GDC_HSSPI_RXF.bit.RFFS)
#define HSSPI_RXF_RFES      (GDC_HSSPI_RXF.bit.RFES)
#define HSSPI_RXF_RFOS      (GDC_HSSPI_RXF.bit.RFOS)
#define HSSPI_RXF_RFUS      (GDC_HSSPI_RXF.bit.RFUS)
#define HSSPI_RXF_RFLETS    (GDC_HSSPI_RXF.bit.RFLETS)
#define HSSPI_RXF_RFMTS     (GDC_HSSPI_RXF.bit.RFMTS)
#define HSSPI_RXF_RSSRS     (GDC_HSSPI_RXF.bit.RSSRS)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_RXE,attr=THIS_ATTR,locate=0x23B3024
#endif

typedef union unHSSPIRXE {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD reserved17:1;
		__WORD reserved16:1;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD reserved11:1;
		__WORD reserved10:1;
		__WORD reserved09:1;
		__WORD reserved08:1;
		__WORD reserved07:1;
		__WORD RSSRE:1;
		__WORD RFMTE:1;
		__WORD RFLETE:1;
		__WORD RFUE:1;
		__WORD RFOE:1;
		__WORD RFEE:1;
		__WORD RFFE:1;
	} bit;
} unHSSPIRXE_t;

__GDC_EXTERN unHSSPIRXE_t GDC_HSSPI_RXE;
#define HSSPI_RXE           (GDC_HSSPI_RXE.word)
#define HSSPI_RXE_RFFE      (GDC_HSSPI_RXE.bit.RFFE)
#define HSSPI_RXE_RFEE      (GDC_HSSPI_RXE.bit.RFEE)
#define HSSPI_RXE_RFOE      (GDC_HSSPI_RXE.bit.RFOE)
#define HSSPI_RXE_RFUE      (GDC_HSSPI_RXE.bit.RFUE)
#define HSSPI_RXE_RFLETE    (GDC_HSSPI_RXE.bit.RFLETE)
#define HSSPI_RXE_RFMTE     (GDC_HSSPI_RXE.bit.RFMTE)
#define HSSPI_RXE_RSSRE     (GDC_HSSPI_RXE.bit.RSSRE)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_RXC,attr=THIS_ATTR,locate=0x23B3028
#endif

typedef union unHSSPIRXC {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD reserved17:1;
		__WORD reserved16:1;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD reserved11:1;
		__WORD reserved10:1;
		__WORD reserved09:1;
		__WORD reserved08:1;
		__WORD reserved07:1;
		__WORD RSSRC:1;
		__WORD RFMTC:1;
		__WORD RFLETC:1;
		__WORD RFUC:1;
		__WORD RFOC:1;
		__WORD RFEC:1;
		__WORD RFFC:1;
	} bit;
} unHSSPIRXC_t;

__GDC_EXTERN unHSSPIRXC_t GDC_HSSPI_RXC;
#define HSSPI_RXC           (GDC_HSSPI_RXC.word)
#define HSSPI_RXC_RFFC      (GDC_HSSPI_RXC.bit.RFFC)
#define HSSPI_RXC_RFEC      (GDC_HSSPI_RXC.bit.RFEC)
#define HSSPI_RXC_RFOC      (GDC_HSSPI_RXC.bit.RFOC)
#define HSSPI_RXC_RFUC      (GDC_HSSPI_RXC.bit.RFUC)
#define HSSPI_RXC_RFLETC    (GDC_HSSPI_RXC.bit.RFLETC)
#define HSSPI_RXC_RFMTC     (GDC_HSSPI_RXC.bit.RFMTC)
#define HSSPI_RXC_RSSRC     (GDC_HSSPI_RXC.bit.RSSRC)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_FAULTF,attr=THIS_ATTR,locate=0x23B302C
#endif

typedef union unHSSPIFAULTF {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD reserved17:1;
		__WORD reserved16:1;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD reserved11:1;
		__WORD reserved10:1;
		__WORD reserved09:1;
		__WORD reserved08:1;
		__WORD reserved07:1;
		__WORD reserved06:1;
		__WORD reserved05:1;
		__WORD reserved04:1;
		__WORD reserved03:1;
		__WORD PVFS:1;
		__WORD WAFS:1;
		__WORD UMAFS:1;
	} bit;
} unHSSPIFAULTF_t;

__GDC_EXTERN unHSSPIFAULTF_t GDC_HSSPI_FAULTF;
#define HSSPI_FAULTF            (GDC_HSSPI_FAULTF.word)
#define HSSPI_FAULTF_UMAFS      (GDC_HSSPI_FAULTF.bit.UMAFS)
#define HSSPI_FAULTF_WAFS       (GDC_HSSPI_FAULTF.bit.WAFS)
#define HSSPI_FAULTF_PVFS       (GDC_HSSPI_FAULTF.bit.PVFS)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_FAULTC,attr=THIS_ATTR,locate=0x23B3030
#endif

typedef union unHSSPIFAULTC {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD reserved17:1;
		__WORD reserved16:1;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD reserved11:1;
		__WORD reserved10:1;
		__WORD reserved09:1;
		__WORD reserved08:1;
		__WORD reserved07:1;
		__WORD reserved06:1;
		__WORD reserved05:1;
		__WORD reserved04:1;
		__WORD reserved03:1;
		__WORD PVFC:1;
		__WORD WAFC:1;
		__WORD UMAFC:1;
	} bit;
} unHSSPIFAULTC_t;

__GDC_EXTERN unHSSPIFAULTC_t GDC_HSSPI_FAULTC;
#define HSSPI_FAULTC            (GDC_HSSPI_FAULTC.word)
#define HSSPI_FAULTC_UMAFC      (GDC_HSSPI_FAULTC.bit.UMAFC)
#define HSSPI_FAULTC_WAFC       (GDC_HSSPI_FAULTC.bit.WAFC)
#define HSSPI_FAULTC_PVFC       (GDC_HSSPI_FAULTC.bit.PVFC)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_DMCFG,attr=THIS_ATTR,locate=0x23B3034
#endif

typedef union unHSSPIDMCFG {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD reserved17:1;
		__WORD reserved16:1;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD reserved11:1;
		__WORD reserved10:1;
		__WORD reserved09:1;
		__WORD reserved08:1;
		__WORD reserved07:1;
		__WORD reserved06:1;
		__WORD reserved05:1;
		__WORD reserved04:1;
		__WORD reserved03:1;
		__WORD reserved02:1;
		__WORD SSDC:1;
		__WORD reserved00:1;
	} bit;
} unHSSPIDMCFG_t;

__GDC_EXTERN unHSSPIDMCFG_t GDC_HSSPI_DMCFG;
#define HSSPI_DMCFG             (GDC_HSSPI_DMCFG.word)
#define HSSPI_DMCFG_SSDC        (GDC_HSSPI_DMCFG.bit.SSDC)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPIDMTRP_DMPSEL_DMSTOP_DMSTART,attr=THIS_ATTR,locate=0x23B3038
#endif

typedef union unHSSPIDMTRP_DMPSEL_DMSTOP_DMSTART {
	__WORD word;
	struct {
		__BYTE DMSTART;
		__BYTE DMSTOP;
		__BYTE DMPSEL;
		__BYTE DMTRP;
	} byte;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD DMTRP_TRP:4;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD DMPSEL_PSEL:2;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD reserved11:1;
		__WORD reserved10:1;
		__WORD reserved09:1;
		__WORD DMSTOP_STOP:1;
		__WORD reserved07:1;
		__WORD reserved06:1;
		__WORD reserved05:1;
		__WORD reserved04:1;
		__WORD reserved03:1;
		__WORD reserved02:1;
		__WORD reserved01:1;
		__WORD DMSTART_START:1;		
	} bit;
} unHSSPIDMTRP_DMPSEL_DMSTOP_DMSTART_t;

__GDC_EXTERN unHSSPIDMTRP_DMPSEL_DMSTOP_DMSTART_t GDC_HSSPIDMTRP_DMPSEL_DMSTOP_DMSTART;
#define HSSPI_DMTRP_TRP        (GDC_HSSPIDMTRP_DMPSEL_DMSTOP_DMSTART.bit.DMTRP_TRP)
#define HSSPI_DMPSEL_PSEL        (GDC_HSSPIDMTRP_DMPSEL_DMSTOP_DMSTART.bit.DMPSEL_PSEL)
#define HSSPI_DMSTART_START        (GDC_HSSPIDMTRP_DMPSEL_DMSTOP_DMSTART.bit.DMSTART_START)
#define HSSPI_DMSTOP_STOP        (GDC_HSSPIDMTRP_DMPSEL_DMSTOP_DMSTART.bit.DMSTOP_STOP)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_DMBCS,attr=THIS_ATTR,locate=0x23B303C
#endif

__GDC_EXTERN __WORD GDC_HSSPI_DMBCS_DMBCC;
#define HSSPI_DMBCS_DMBCC (GDC_HSSPI_DMBCS_DMBCC)

#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_DMSTATUS,attr=THIS_ATTR,locate=0x23B3040
#endif

typedef union unHSSPIDMSTATUS {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD TXLEVEL:5;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD RXLEVEL:5;
		__WORD reserved07:1;
		__WORD reserved06:1;
		__WORD reserved05:1;
		__WORD reserved04:1;
		__WORD reserved03:1;
		__WORD reserved02:1;
		__WORD TXACTIVE:1;
		__WORD RXACTIVE:1;
	} bit;
} unHSSPIDMSTATUS_t;

__GDC_EXTERN unHSSPIDMSTATUS_t GDC_HSSPI_DMSTATUS;
#define HSSPI_DMSTATUS                 (GDC_HSSPI_DMSTATUS.word)
#define HSSPI_DMSTATUS_RXACTIVE        (GDC_HSSPI_DMSTATUS.bit.RXACTIVE)
#define HSSPI_DMSTATUS_TXACTIVE        (GDC_HSSPI_DMSTATUS.bit.TXACTIVE)
#define HSSPI_DMSTATUS_RXLEVEL         (GDC_HSSPI_DMSTATUS.bit.RXLEVEL)
#define HSSPI_DMSTATUS_TXLEVEL         (GDC_HSSPI_DMSTATUS.bit.TXLEVEL)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_RXBITCNT,attr=THIS_ATTR,locate=0x23B3046
#endif

typedef union unHSSPIRXBITCNT {
	__BYTE byte;
	struct {
		__BYTE reserved07:1;
		__BYTE reserved06:1;
		__BYTE RXBITCNT:6;
	} bit;
} unHSSPIRXBITCNT_t;

__GDC_EXTERN unHSSPIRXBITCNT_t GDC_HSSPI_RXBITCNT;
#define HSSPI_RXBITCNT                 (GDC_HSSPI_RXBITCNT.byte)
#define HSSPI_RXBITCNT_RXBITCNT        (GDC_HSSPI_RXBITCNT.bit.RXBITCNT)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_TXBITCNT,attr=THIS_ATTR,locate=0x23B3047
#endif

typedef union unHSSPITXBITCNT {
	__BYTE byte;
	struct {
		__BYTE reserved07:1;
		__BYTE reserved06:1;
		__BYTE TXBITCNT:6;
	} bit;
} unHSSPITXBITCNT_t;

__GDC_EXTERN unHSSPITXBITCNT_t GDC_HSSPI_TXBITCNT;
#define HSSPI_TXBITCNT                 (GDC_HSSPI_RXBITCNT.byte)
#define HSSPI_TXBITCNT_TXBITCNT        (GDC_HSSPI_RXBITCNT.bit.TXBITCNT)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_FIFOCFG,attr=THIS_ATTR,locate=0x23B304C
#endif

typedef union unHSSPIFIFOCFG {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD reserved19:1;
		__WORD reserved18:1;
		__WORD reserved17:1;
		__WORD reserved16:1;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD TXFLSH:1;
		__WORD RXFLSH:1;
		__WORD TXCTRL:1;
		__WORD FWIDTH:2;
		__WORD TXFTH:4;
		__WORD RXFTH:4;
	} bit;
} unHSSPIFIFOCFG_t;

__GDC_EXTERN unHSSPIFIFOCFG_t GDC_HSSPI_FIFOCFG;
#define HSSPI_FIFOCFG	               (GDC_HSSPI_FIFOCFG.word)
#define HSSPI_FIFOCFG_RXFTH	           (GDC_HSSPI_FIFOCFG.bit.RXFTH)
#define HSSPI_FIFOCFG_TXFTH	           (GDC_HSSPI_FIFOCFG.bit.TXFTH)
#define HSSPI_FIFOCFG_FWIDTH	       (GDC_HSSPI_FIFOCFG.bit.FWIDTH)
#define HSSPI_FIFOCFG_TXCTRL	       (GDC_HSSPI_FIFOCFG.bit.TXCTRL)
#define HSSPI_FIFOCFG_RXFLSH	       (GDC_HSSPI_FIFOCFG.bit.RXFLSH)
#define HSSPI_FIFOCFG_TXFLSH	       (GDC_HSSPI_FIFOCFG.bit.TXFLSH)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_TXFIFO,attr=THIS_ATTR,locate=0x23B3050
#endif

__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO15;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO14;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO13;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO12;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO11;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO10;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO9;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO8;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO7;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO6;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO5;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO4;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO3;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO2;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO1;
__GDC_EXTERN __WORD GDC_HSSPI_TXFIFO0;

#define HSSPI_TXFIFO0	GDC_HSSPI_TXFIFO0
#define HSSPI_TXFIFO1	GDC_HSSPI_TXFIFO1
#define HSSPI_TXFIFO2	GDC_HSSPI_TXFIFO2
#define HSSPI_TXFIFO3	GDC_HSSPI_TXFIFO3
#define HSSPI_TXFIFO4	GDC_HSSPI_TXFIFO4
#define HSSPI_TXFIFO5	GDC_HSSPI_TXFIFO5
#define HSSPI_TXFIFO6	GDC_HSSPI_TXFIFO6
#define HSSPI_TXFIFO7	GDC_HSSPI_TXFIFO7
#define HSSPI_TXFIFO8	GDC_HSSPI_TXFIFO8
#define HSSPI_TXFIFO9	GDC_HSSPI_TXFIFO9
#define HSSPI_TXFIFO10	GDC_HSSPI_TXFIFO10
#define HSSPI_TXFIFO11	GDC_HSSPI_TXFIFO11
#define HSSPI_TXFIFO12	GDC_HSSPI_TXFIFO12
#define HSSPI_TXFIFO13	GDC_HSSPI_TXFIFO13
#define HSSPI_TXFIFO14	GDC_HSSPI_TXFIFO14
#define HSSPI_TXFIFO15	GDC_HSSPI_TXFIFO15


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_RXFIFO,attr=THIS_ATTR,locate=0x23B3090
#endif

__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO15;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO14;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO13;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO12;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO11;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO10;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO9;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO8;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO7;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO6;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO5;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO4;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO3;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO2;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO1;
__GDC_EXTERN __WORD GDC_HSSPI_RXFIFO0;

#define HSSPI_RXFIFO0	GDC_HSSPI_RXFIFO0
#define HSSPI_RXFIFO1	GDC_HSSPI_RXFIFO1
#define HSSPI_RXFIFO2	GDC_HSSPI_RXFIFO2
#define HSSPI_RXFIFO3	GDC_HSSPI_RXFIFO3
#define HSSPI_RXFIFO4	GDC_HSSPI_RXFIFO4
#define HSSPI_RXFIFO5	GDC_HSSPI_RXFIFO5
#define HSSPI_RXFIFO6	GDC_HSSPI_RXFIFO6
#define HSSPI_RXFIFO7	GDC_HSSPI_RXFIFO7
#define HSSPI_RXFIFO8	GDC_HSSPI_RXFIFO8
#define HSSPI_RXFIFO9	GDC_HSSPI_RXFIFO9
#define HSSPI_RXFIFO10	GDC_HSSPI_RXFIFO10
#define HSSPI_RXFIFO11	GDC_HSSPI_RXFIFO11
#define HSSPI_RXFIFO12	GDC_HSSPI_RXFIFO12
#define HSSPI_RXFIFO13	GDC_HSSPI_RXFIFO13
#define HSSPI_RXFIFO14	GDC_HSSPI_RXFIFO14
#define HSSPI_RXFIFO15	GDC_HSSPI_RXFIFO15



#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_CSCFG,attr=THIS_ATTR,locate=0x23B30D0
#endif

typedef union unHSSPICSCFG {
	__WORD word;
	struct {
		__WORD reserved31:1;
		__WORD reserved30:1;
		__WORD reserved29:1;
		__WORD reserved28:1;
		__WORD reserved27:1;
		__WORD reserved26:1;
		__WORD reserved25:1;
		__WORD reserved24:1;
		__WORD reserved23:1;
		__WORD reserved22:1;
		__WORD reserved21:1;
		__WORD reserved20:1;
		__WORD MSEL:4;
		__WORD reserved15:1;
		__WORD reserved14:1;
		__WORD reserved13:1;
		__WORD reserved12:1;
		__WORD SSEL3EN:1;
		__WORD SSEL2EN:1;
		__WORD SSEL1EN:1;
		__WORD SSEL0EN:1;
		__WORD reserved07:1;
		__WORD reserved06:1;
		__WORD reserved05:1;
		__WORD reserved04:1;
		__WORD reserved03:1;
		__WORD MBM:2;
		__WORD SRAM:1;
	} bit;
} unHSSPICSCFG_t;

__GDC_EXTERN unHSSPICSCFG_t GDC_HSSPI_CSCFG;
#define HSSPI_CSCFG				(GDC_HSSPI_CSCFG.word)
#define HSSPI_CSCFG_MSEL		(GDC_HSSPI_CSCFG.bit.MSEL)
#define HSSPI_CSCFG_SSEL0EN		(GDC_HSSPI_CSCFG.bit.SSEL0EN)
#define HSSPI_CSCFG_SSEL1EN		(GDC_HSSPI_CSCFG.bit.SSEL1EN)
#define HSSPI_CSCFG_SSEL2EN		(GDC_HSSPI_CSCFG.bit.SSEL2EN)
#define HSSPI_CSCFG_SSEL3EN		(GDC_HSSPI_CSCFG.bit.SSEL3EN)
#define HSSPI_CSCFG_MBM			(GDC_HSSPI_CSCFG.bit.MBM)
#define HSSPI_CSCFG_SRAM		(GDC_HSSPI_CSCFG.bit.SRAM)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_RDCSDC,attr=THIS_ATTR,locate=0x23B30DC
#endif

typedef union unHSSPIRDCSDC {
	__WORD word;
	struct {
		__HWORD RDCSDC0;
		__HWORD RDCSDC1;
	} hword;
} unHSSPIRDCSDC_t;

__GDC_EXTERN unHSSPIRDCSDC_t GDC_HSSPI_RDCSDC76;
__GDC_EXTERN unHSSPIRDCSDC_t GDC_HSSPI_RDCSDC54;
__GDC_EXTERN unHSSPIRDCSDC_t GDC_HSSPI_RDCSDC32;
__GDC_EXTERN unHSSPIRDCSDC_t GDC_HSSPI_RDCSDC10;

#define HSSPI_RDCSDC0	(GDC_HSSPI_RDCSDC10.hword.RDCSDC0)
#define HSSPI_RDCSDC1	(GDC_HSSPI_RDCSDC10.hword.RDCSDC1)
#define HSSPI_RDCSDC2	(GDC_HSSPI_RDCSDC32.hword.RDCSDC0)
#define HSSPI_RDCSDC3	(GDC_HSSPI_RDCSDC32.hword.RDCSDC1)
#define HSSPI_RDCSDC4	(GDC_HSSPI_RDCSDC54.hword.RDCSDC0)
#define HSSPI_RDCSDC5	(GDC_HSSPI_RDCSDC54.hword.RDCSDC1)
#define HSSPI_RDCSDC6	(GDC_HSSPI_RDCSDC76.hword.RDCSDC0)
#define HSSPI_RDCSDC7	(GDC_HSSPI_RDCSDC76.hword.RDCSDC1)


#ifdef __GDC_DEFINE
#pragma segment     DATA=GDC_HSSPI_MID,attr=THIS_ATTR,locate=0x23B30FC
#endif

__GDC_EXTERN __WORD GDC_HSSPI_MID;
#define HSSPI_MID (GDC_HSSPI_MID)


#ifdef __GDC_DEFINE
#pragma segment DATA
#endif /* GDC_DEFINE */


//Define High Speed SPI Controller Module Address
#define REG_HSSPI_MCTRL		(0x023B3000UL + 0x000UL)
#define REG_HSSPI_PCC(x)		(0x023B3000UL + 0x004UL + 0x004UL*x)
#define REG_HSSPIn_CSCFG		(0x023B3000UL + 0x0D0UL)
#define REG_HSSPIn_CSITIME		(0x023B3000UL + 0x0D4UL)
#define REG_HSSPIn_CSAEXT		(0x023B3000UL + 0x0D8UL)
#define REG_HSSPIn_RDCSDC(x)	(0x023B3000UL + 0x0DCUL + 0x004UL*x)
#define REG_HSSPIn_WRCSDC(x)	(0x023B3000UL + 0x0ECUL + 0x004UL*x)
#define REG_HSSPIn_MID			(0x023B3000UL + 0x0FCUL)
#define REG_HSSPIn_FIFOCFG		(0x023B3000UL + 0x04CUL)
#define REG_HSSPIn_DMCFG		(0x023B3000UL + 0x034UL)

void HSSPI_initDirectMode();
void HSSPI_initCommandSequencerMode();

void HSSPI_init();

#endif
